import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '变量名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '变量标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '变量值',
    align: "center",
    dataIndex: 'value'
  },
  {
    title: '是否隐藏 0显示，1隐藏',
    align: "center",
    dataIndex: 'isHidden'
  },
];
columns.forEach(item=>{
  item.resizable=true
})
//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '变量名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入变量名!'},
             ];
    },
  },
  {
    label: '变量标题',
    field: 'title',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入变量标题!'},
             ];
    },
  },
  {
    label: '变量值',
    field: 'value',
    component: 'InputTextArea',
  },
  {
    label: '是否隐藏 0显示，1隐藏',
    field: 'isHidden',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否隐藏 0显示，1隐藏!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
